
export class R<T = any>{
    private code: String;
    private success: Boolean;
    private msg: String;
    private body: T;
    private extra: any;


    constructor(code: String, success: Boolean, msg: String, body: T, extra: any) {
        this.code = code
        this.success = success
        this.msg = msg
        this.body = body
        this.extra = extra
    }

    public static ok<T>(body: T): R<T> {
        return new R('0', true, '', body, null);
    }

    public getCode(): String {
        return this.code
    }

    public setCode(code: String) {
        this.code = code
    }

    public getSuccess(): Boolean {
        return this.success
    }

    public setSuccess(success: Boolean) {
        this.success = success
    }

    public getMsg(): String {
        return this.msg
    }

    public setMsg(msg: String) {
        this.msg = msg
    }

    public getBody(): T {
        return this.body
    }

    public setBody(body: T) {
        this.body = body
    }

    public getExtra(): any {
        return this.extra
    }

    public setExtra(extra: any) {
        this.extra = extra
    }




}